package com.yuanfeng.business.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanfeng.business.entity.ShopTemplateEntity;
import com.yuanfeng.business.mapper.ShopTemplateMapper;
import com.yuanfeng.business.service.ShopTemplateService;
import com.yuanfeng.commoms.exception.BizCodeEnume;
import com.yuanfeng.commoms.util.ParseTokenUtils;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.user.UserInfoVO;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 *
 */
@Service
public class ShopTemplateServiceImpl extends ServiceImpl<ShopTemplateMapper, ShopTemplateEntity>
    implements ShopTemplateService{

    @Override
    public ResponseResult query(Map<String, Object> param) {
        ShopTemplateEntity entity=null;
        // 获取用户信息
        UserInfoVO userInfoVO = ParseTokenUtils.getUserInfoByToken(param.get("token").toString());

        if (userInfoVO != null) {

            entity = this.baseMapper.selectById(param.get("shopTempName").toString());

        } else {
            return ResponseResult.fail(BizCodeEnume.INSUFFICIENT_PERMISSIONS);
        }
        return ResponseResult.success(entity);
    }
}




